package cn.iocoder.yudao.module.member.dal.mysql.interviewInvite;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.interviewInvite.InterviewInviteDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.interviewInvite.vo.*;

/**
 * 面试邀约 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface InterviewInviteMapper extends BaseMapperX<InterviewInviteDO> {

    default PageResult<InterviewInviteDO> selectPage(InterviewInvitePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InterviewInviteDO>()
                .eqIfPresent(InterviewInviteDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(InterviewInviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InterviewInviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(InterviewInviteDO::getEmail, reqVO.getEmail())
                .betweenIfPresent(InterviewInviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .eqIfPresent(InterviewInviteDO::getCompanyId, reqVO.getCompanyId())
                .likeIfPresent(InterviewInviteDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(InterviewInviteDO::getPublisherId, reqVO.getPublisherId())
                .eqIfPresent(InterviewInviteDO::getSendRecordId, reqVO.getSendRecordId())
                .likeIfPresent(InterviewInviteDO::getPublisherName, reqVO.getPublisherName())
                .inIfPresent(InterviewInviteDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InterviewInviteDO::getInviteContent, reqVO.getInviteContent())
                .eqIfPresent(InterviewInviteDO::getJobId, reqVO.getJobId())
                .likeIfPresent(InterviewInviteDO::getJobName, reqVO.getJobName())
                .eqIfPresent(InterviewInviteDO::getInviteWay, reqVO.getInviteWay())
                .eqIfPresent(InterviewInviteDO::getInviteAddress, reqVO.getInviteAddress())
                .eqIfPresent(InterviewInviteDO::getInviteCoordinate, reqVO.getInviteCoordinate())
                .eqIfPresent(InterviewInviteDO::getNoticeItem, reqVO.getNoticeItem())
                .eqIfPresent(InterviewInviteDO::getInviteResult, reqVO.getInviteResult())
                .eqIfPresent(InterviewInviteDO::getEvaluation, reqVO.getEvaluation())
                .eqIfPresent(InterviewInviteDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InterviewInviteDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(InterviewInviteDO::getId));
    }

    default List<InterviewInviteDO> selectList(InterviewInviteExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InterviewInviteDO>()
                .eqIfPresent(InterviewInviteDO::getJobId, reqVO.getJobId())
                .eqIfPresent(InterviewInviteDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(InterviewInviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InterviewInviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(InterviewInviteDO::getEmail, reqVO.getEmail())
                .betweenIfPresent(InterviewInviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .eqIfPresent(InterviewInviteDO::getCompanyId, reqVO.getCompanyId())
                .likeIfPresent(InterviewInviteDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(InterviewInviteDO::getPublisherId, reqVO.getPublisherId())
                .eqIfPresent(InterviewInviteDO::getSendRecordId, reqVO.getSendRecordId())
                .likeIfPresent(InterviewInviteDO::getPublisherName, reqVO.getPublisherName())
                .eqIfPresent(InterviewInviteDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InterviewInviteDO::getInviteContent, reqVO.getInviteContent())
                .likeIfPresent(InterviewInviteDO::getJobName, reqVO.getJobName())
                .eqIfPresent(InterviewInviteDO::getInviteWay, reqVO.getInviteWay())
                .eqIfPresent(InterviewInviteDO::getInviteAddress, reqVO.getInviteAddress())
                .eqIfPresent(InterviewInviteDO::getInviteCoordinate, reqVO.getInviteCoordinate())
                .eqIfPresent(InterviewInviteDO::getNoticeItem, reqVO.getNoticeItem())
                .eqIfPresent(InterviewInviteDO::getInviteResult, reqVO.getInviteResult())
                .eqIfPresent(InterviewInviteDO::getEvaluation, reqVO.getEvaluation())
                .eqIfPresent(InterviewInviteDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InterviewInviteDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(InterviewInviteDO::getId));
    }

    default List<InterviewInviteDO> selectList(InterviewInviteReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InterviewInviteDO>()
                .eqIfPresent(InterviewInviteDO::getJobId, reqVO.getJobId())
                .eqIfPresent(InterviewInviteDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(InterviewInviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InterviewInviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(InterviewInviteDO::getEmail, reqVO.getEmail())
                .betweenIfPresent(InterviewInviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .eqIfPresent(InterviewInviteDO::getCompanyId, reqVO.getCompanyId())
                .likeIfPresent(InterviewInviteDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(InterviewInviteDO::getPublisherId, reqVO.getPublisherId())
                .eqIfPresent(InterviewInviteDO::getSendRecordId, reqVO.getSendRecordId())
                .likeIfPresent(InterviewInviteDO::getPublisherName, reqVO.getPublisherName())
                .eqIfPresent(InterviewInviteDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InterviewInviteDO::getInviteContent, reqVO.getInviteContent())
                .likeIfPresent(InterviewInviteDO::getJobName, reqVO.getJobName())
                .eqIfPresent(InterviewInviteDO::getInviteWay, reqVO.getInviteWay())
                .eqIfPresent(InterviewInviteDO::getInviteAddress, reqVO.getInviteAddress())
                .eqIfPresent(InterviewInviteDO::getInviteCoordinate, reqVO.getInviteCoordinate())
                .eqIfPresent(InterviewInviteDO::getNoticeItem, reqVO.getNoticeItem())
                .eqIfPresent(InterviewInviteDO::getInviteResult, reqVO.getInviteResult())
                .eqIfPresent(InterviewInviteDO::getEvaluation, reqVO.getEvaluation())
                .eqIfPresent(InterviewInviteDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InterviewInviteDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(InterviewInviteDO::getId));
    }




    default Long resultCount(Long  studentId,List<String> status) {
        return selectCount(new LambdaQueryWrapperX<InterviewInviteDO>()
                .inIfPresent(InterviewInviteDO::getStatus, status)
                .eq(InterviewInviteDO::getStudentId,studentId)
        );
    }

    default Long resultCount(Long  studentId,String status) {
        return selectCount(new LambdaQueryWrapperX<InterviewInviteDO>()
                .eqIfPresent(InterviewInviteDO::getShowStatus, status)
                .eq(InterviewInviteDO::getStudentId,studentId)
        );
    }

}
